# !/usr/bin/env python
# coding=utf-8
# @Time    : 2018/5/9 16:07
# @Author  : 6imensiva
# @Site    : https://gitee.com/dimensiva/scrayp_test1.git
# @File    : __init__.py.py
# @Software: PyCharm
# @Version: 2.7.5
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.ext.declarative import declarative_base
from configs import current_config


# 创建对象的基类:
Base = declarative_base()
# 初始化数据库连接:
print(current_config.MYSQL_URI)
_engine = create_engine(current_config.MYSQL_URI)
# 创建DBSession类型:
_DBSession = sessionmaker(bind=_engine)
Session = scoped_session(_DBSession)